using System;
using System.Configuration;
using System.Drawing;
using System.Web.UI;
using AdHocReports.Properties;
using AdHocReports;
using System.Collections.Generic;

public partial class _default : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ReportDefinition.ResetDefintion();
        MasterPage.NextEnabled = false;
        MasterPage.BackEnabled = false;
        MasterPage.CancelEnabled = false;
        MasterPage.ContentTitle = "Error";

        List<ConnectionStringSettings> connections = new List<ConnectionStringSettings>();
        foreach (ConnectionStringSettings connection in ConfigurationManager.ConnectionStrings)
        {
            if (connection.Name != "AdHocReports.Properties.Settings.SavedReports")
            {
                connections.Add(connection);
            }
        }

        if (connections.Count > 0)
        {
            ConnectionStringSettings connection = connections[0];
            if (connection != null)
            {
                if (ReportDefinition.ConnectionString.Length == 0)
                {
                    ReportDefinition.ConnectionString = connection.ConnectionString;
                    ReportDefinition.Current = ReportDefinition;
                    Response.Redirect("step2.aspx");
                }
            }
        }
    }
}
